package cn.mux.jdk8.stream;

import java.util.stream.IntStream;


public class TestStream {
	public static void main(String[] args) {
		IntStream intStream = IntStream.builder().add(5).add(7).add(-3).add(34).build();
		//System.out.println("最大值:"+intStream.max().getAsInt());
		//System.out.println("最小值:"+intStream.min().getAsInt());
		//System.out.println("总和:"+intStream.sum());	System.out.println(calAll(books, str->((String)str).contains("java")));
		//System.out.println("总数:"+intStream.count());
		//System.out.println("平均值:"+intStream.average());
		//所有元素的平方是否都大于20
		System.out.println("所有元素的平方是否都大于20:"+intStream.allMatch(str->str*str >20));
		//是否包含任何元素的平方大于20
		System.out.println("是否包含任何元素的平方大于20:"+intStream.anyMatch(str->str*str >20));
	   //把intStream 映射成一个新的stream , 
		IntStream isStream  = intStream.map(ele->ele*2+1);
		isStream.forEach(System.out::println);
	
	}
}
